Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dict_compiler): rebuild packs on demand #816

Merged
merged 2 commits into from
Feb 13, 2024

Conversation

ksqsf
Copy link
Member

@ksqsf ksqsf commented Feb 11, 2024

Pull request

Issue tracker

Fixes will automatically close the related issue

Fixes #

Feature

Rebuild packs if the pack source dict file is updated, even if the primary table is not updated.

Previously, packs are only rebuilt after the primary table is rebuilt.

Unit test

  • Done

Manual test

  • Done

Tested with:

  • no packs
  • one pack, build successful, able to use words in the pack
  • one pack, unmodified, won't rebuild
  • one pack, remove source file, able to use the prebuilt table
  • one pack, modified, can rebuild automatically
  • multiple packs, remove one source file, the other can still be used
  • multiple packs, only modified pack gets rebuilt
  • modified primary dict, all packs will be rebuilt except those lacking source files (I'm not sure if this is safe, but the current design of dictionary packs is also vulnerable to this kind of problem.)

Code Review

  1. Unit and manual test pass
  2. GitHub Action CI pass
  3. At least one contributor reviews and votes
  4. Can be merged clean without conflicts
  5. PR will be merged by rebase upstream base

Additional Info

To test, create two dict.yaml files:

# Rime dict
---
name: sample_pack1
version: '1.0'
sort: original
use_preset_vocabulary: false
...

粗鄙之語	cu bi zhi yu
---
name: sample_pack2
version: '1.0'
sort: original
use_preset_vocabulary: false
...

粗鄙之語児	cu bi zhi yu er

Edit luna_pinyin.schema.yaml so the packs can be built and loaded:

translator:
  #...
  packs:
    - sample_pack1
    - sample_pack2
image

Rebuild packs if the pack source dict file is updated, even if the
primary table is not updated.

Previously, packs are only rebuilt after the primary table is updated.
Copy link
Member

@lotem lotem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

强强强

@ksqsf ksqsf merged commit 28d1e7e into rime:master Feb 13, 2024
9 checks passed
graphemecluster pushed a commit to TypeDuck-HK/librime that referenced this pull request Mar 18, 2024
Rebuild packs if the pack source dict file is updated, even if the
primary table is not updated.

Previously, packs are only rebuilt after the primary table is updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants